Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

91
Vistas
JavaScript: How to Writeln "</script>" without ending the actual script

I am making a code editor similar to Codepen, however when I try to make my Javascript textarea to say </script>, it will think I want to end the script of the actual program.

<script>
    function compile() {
      var html = document.getElementById("html");
      var css = document.getElementById("css");
      var js = document.getElementById("js");
      var code = document.getElementById("code").contentWindow.document;

          submit = () => {
              code.open();
              code.writeln(
              html.value +
                  "<style>" +
                  css.value +
                  "</style>" +
                  "<script>" +
                  js.value +
                  "</script>"
              );
              code.close();
          };
      }
      compile();
  </script>

I understand this could be easily fixed by instead making this a separate .js file, but I want to know how to put this script in an HTML file without it thinking "" is to end the actual html files script.

Thank you in advance

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda